package com.example.model;

import java.sql.Timestamp;

public class Article {
    private int id;
    private String title;
    private String type;
    private String content;
    private String author;
    private Timestamp createTime;
    private Timestamp submit_time;
    private String status;
    private String authorName;
    private int views;
    private int likes;

    public int getId() { return id; }
    public void setId(int id) { this.id = id; }
    public String getTitle() { return title; }
    public void setTitle(String title) { this.title = title; }
    public String getType() { return type; }
    public void setType(String type) { this.type = type; }
    public String getContent() { return content; }
    public void setContent(String content) { this.content = content; }
    public String getAuthor() { return author; }
    public void setAuthor(String author) { this.author = author; }
    public Timestamp getCreateTime() { return createTime; }
    public void setCreateTime(Timestamp createTime) { this.createTime = createTime; }
    public Timestamp getSubmit_time() { return submit_time; }
    public void setSubmit_time(Timestamp submit_time) { this.submit_time = submit_time; }
    public String getStatus() { return status; }
    public void setStatus(String status) { this.status = status; }
    public String getAuthorName() { return authorName; }
    public void setAuthorName(String authorName) { this.authorName = authorName; }
    public int getViews() { return views; }
    public void setViews(int views) { this.views = views; }
    public int getLikes() { return likes; }
    public void setLikes(int likes) { this.likes = likes; }

    // 新增：JSP 兼容方法
    public String getDate() {
        if (createTime == null) return "";
        return new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm").format(createTime);
    }

    public String getSummary() {
        if (content == null) return "";
        return content.length() > 50 ? content.substring(0, 50) + "..." : content;
    }
} 